<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('运营指标')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<style>
    select {
        padding-top: 3px !important;
    }

    .select-list {
        margin-top: 5px !important;
    }
</style>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="index-form">
                    <div class="col-sm-12">
                        <div class="select-list">
                            <ul>
                                <li>
                                    <p>年份：</p>
                                    <select name="years" class="form-control">
                                        <option value="">请选择</option>
                                        <option th:each="years : ${years}" th:text="${years.years}+'年'"
                                                th:value="${years.years}"></option>
                                    </select>
                                </li>
                                <li>
                                    <p>月份：</p>
                                    <select name="months" class="form-control">
                                        <option value="">请选择</option>
                                        <option th:each="months : ${months}" th:text="${months.monthInYear}+'月'"
                                                th:value="${months.monthInYear}"></option>
                                    </select>
                                </li>
                                <li>
                                    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                            class="fa fa-search"></i>&nbsp;搜索</a>
                                    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                            class="fa fa-refresh"></i>&nbsp;重置</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()">
                    <i class="fa fa-plus"></i> 新增
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<script th:inline="javascript">
    var prefix = ctx + "biIndex";

    $(function () {
        queryList();
    });

    function queryList(){
        var options = {
            uniqueId: "id",
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove/{id}",
            modalName: "运营指标",
            columns: [{
                checkbox: true
            },
                {
                    field: 'years',
                    title: '年份'
                },
                {
                    field: 'months',
                    title: '月份'
                },
                {
                    field: 'completionRate',
                    title: '一级节点完成率'
                },
                {
                    field: 'changeRate',
                    title: '当年产值转化率'
                },
                {
                    field: 'perOutputValue',
                    title: '人均产值'
                },
                {
                    field: 'perGrossProfit',
                    title: '人均毛利'
                },
                {
                    field: 'strCycle',
                    title: '开工竣备周期'
                },
                {
                    field: 'accountPeriod',
                    title: '应收账款账期'
                },
                {
                    title: '操作',
                    align: 'left',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    }

</script>
</body>
</html>